<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Iterator Concepts</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="Chapter 1. Boost.Iterator">
<link rel="up" href="../index.html" title="Chapter 1. Boost.Iterator">
<link rel="prev" href="../index.html" title="Chapter 1. Boost.Iterator">
<link rel="next" href="concepts/traversal.html" title="Traversal">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
<td align="center"><a href="../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../index.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="concepts/traversal.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="iterator.concepts"></a><a class="link" href="concepts.html" title="Iterator Concepts">Iterator Concepts</a>
</h2></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="concepts.html#iterator.concepts.access">Access</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="concepts.html#iterator.concepts.access.readable">Readable Iterator
        Concept</a></span></dt>
<dt><span class="section"><a href="concepts.html#iterator.concepts.access.writable">Writable Iterator
        Concept</a></span></dt>
<dt><span class="section"><a href="concepts.html#iterator.concepts.access.swappable">Swappable Iterator
        Concept</a></span></dt>
<dt><span class="section"><a href="concepts.html#iterator.concepts.access.lvalue">Lvalue Iterator Concept</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="concepts/traversal.html">Traversal</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="concepts/traversal.html#iterator.concepts.traversal.incrementable">Incrementable
        Iterator Concept</a></span></dt>
<dt><span class="section"><a href="concepts/traversal.html#iterator.concepts.traversal.single_pass">Single Pass
        Iterator Concept</a></span></dt>
<dt><span class="section"><a href="concepts/traversal.html#iterator.concepts.traversal.forward">Forward Traversal
        Concept</a></span></dt>
<dt><span class="section"><a href="concepts/traversal.html#iterator.concepts.traversal.bidirectional">Bidirectional
        Traversal Concept</a></span></dt>
<dt><span class="section"><a href="concepts/traversal.html#iterator.concepts.traversal.random_access">Random Access
        Traversal Concept</a></span></dt>
</dl></dd>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="iterator.concepts.access"></a><a class="link" href="concepts.html#iterator.concepts.access" title="Access">Access</a>
</h3></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="concepts.html#iterator.concepts.access.readable">Readable Iterator
        Concept</a></span></dt>
<dt><span class="section"><a href="concepts.html#iterator.concepts.access.writable">Writable Iterator
        Concept</a></span></dt>
<dt><span class="section"><a href="concepts.html#iterator.concepts.access.swappable">Swappable Iterator
        Concept</a></span></dt>
<dt><span class="section"><a href="concepts.html#iterator.concepts.access.lvalue">Lvalue Iterator Concept</a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="iterator.concepts.access.readable"></a><a class="link" href="concepts.html#iterator.concepts.access.readable" title="Readable Iterator Concept">Readable Iterator
        Concept</a>
</h4></div></div></div>
<p>
          A class or built-in type <code class="computeroutput"><span class="identifier">X</span></code>
          models the <span class="bold"><strong>Readable Iterator</strong></span> concept for
          value type <code class="computeroutput"><span class="identifier">T</span></code> if, in addition
          to <code class="computeroutput"><span class="identifier">X</span></code> being Assignable and
          Copy Constructible, the following expressions are valid and respect the
          stated semantics. <code class="computeroutput"><span class="identifier">U</span></code> is
          the type of any specified member of type <code class="computeroutput"><span class="identifier">T</span></code>.
        </p>
<div class="table">
<a name="iterator.concepts.access.readable.readable_iterator_requirements_i"></a><p class="title"><b>Table 1.1. Readable Iterator Requirements (in addition to Assignable and Copy
          Constructible)</b></p>
<div class="table-contents"><table class="table" summary="Readable Iterator Requirements (in addition to Assignable and Copy
          Constructible)">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                  <p>
                    Expression
                  </p>
                </th>
<th>
                  <p>
                    Return Type
                  </p>
                </th>
<th>
                  <p>
                    Note/Precondition
                  </p>
                </th>
</tr></thead>
<tbody>
<tr>
<td>
                  <p>
                    <code class="computeroutput"><span class="identifier">iterator_traits</span><span class="special">&lt;</span><span class="identifier">X</span><span class="special">&gt;::</span><span class="identifier">value_type</span></code>
                  </p>
                </td>
<td>
                  <p>
                    <code class="computeroutput"><span class="identifier">T</span></code>
                  </p>
                </td>
<td>
                  <p>
                    Any non-reference, non cv-qualified type
                  </p>
                </td>
</tr>
<tr>
<td>
                  <p>
                    <code class="computeroutput"><span class="special">*</span><span class="identifier">a</span></code>
                  </p>
                </td>
<td>
                  <p>
                    Convertible to <code class="computeroutput"><span class="identifier">T</span></code>
                  </p>
                </td>
<td>
                  <p>
                    pre: <code class="computeroutput"><span class="identifier">a</span></code> is dereferenceable.
                    If <code class="computeroutput"><span class="identifier">a</span> <span class="special">==</span>
                    <span class="identifier">b</span></code> then <code class="computeroutput"><span class="special">*</span><span class="identifier">a</span></code>
                    is equivalent to <code class="computeroutput"><span class="special">*</span><span class="identifier">b</span></code>.
                  </p>
                </td>
</tr>
<tr>
<td>
                  <p>
                    <code class="computeroutput"><span class="identifier">a</span><span class="special">-&gt;</span><span class="identifier">m</span></code>
                  </p>
                </td>
<td>
                  <p>
                    <code class="computeroutput"><span class="identifier">U</span><span class="special">&amp;</span></code>
                  </p>
                </td>
<td>
                  <p>
                    pre: <code class="computeroutput"><span class="special">(*</span><span class="identifier">a</span><span class="special">).</span><span class="identifier">m</span></code>
                    is well-defined. Equivalent to <code class="computeroutput"><span class="special">(*</span><span class="identifier">a</span><span class="special">).</span><span class="identifier">m</span></code>.
                  </p>
                </td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break">
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="iterator.concepts.access.writable"></a><a class="link" href="concepts.html#iterator.concepts.access.writable" title="Writable Iterator Concept">Writable Iterator
        Concept</a>
</h4></div></div></div>
<p>
          A class or built-in type <code class="computeroutput"><span class="identifier">X</span></code>
          models the <span class="bold"><strong>Writable Iterator</strong></span> concept if,
          in addition to <code class="computeroutput"><span class="identifier">X</span></code> being
          Copy Constructible, the following expressions are valid and respect the
          stated semantics. Writable Iterators have an associated <span class="bold"><strong>set
          of value types</strong></span>.
        </p>
<div class="table">
<a name="iterator.concepts.access.writable.writable_iterator_requirements_i"></a><p class="title"><b>Table 1.2. Writable Iterator Requirements (in addition to Copy Constructible)</b></p>
<div class="table-contents"><table class="table" summary="Writable Iterator Requirements (in addition to Copy Constructible)">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                  <p>
                    Expression
                  </p>
                </th>
<th>
                  <p>
                    Return Type
                  </p>
                </th>
<th>
                  <p>
                    Precondition
                  </p>
                </th>
</tr></thead>
<tbody><tr>
<td>
                  <p>
                    <code class="computeroutput"><span class="special">*</span><span class="identifier">a</span>
                    <span class="special">=</span> <span class="identifier">o</span></code>
                  </p>
                </td>
<td>
                </td>
<td>
                  <p>
                    pre: The type of <code class="computeroutput"><span class="identifier">o</span></code>
                    is in the set of value types of <code class="computeroutput"><span class="identifier">X</span></code>
                  </p>
                </td>
</tr></tbody>
</table></div>
</div>
<br class="table-break">
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="iterator.concepts.access.swappable"></a><a class="link" href="concepts.html#iterator.concepts.access.swappable" title="Swappable Iterator Concept">Swappable Iterator
        Concept</a>
</h4></div></div></div>
<p>
          A class or built-in type <code class="computeroutput"><span class="identifier">X</span></code>
          models the <span class="bold"><strong>Swappable Iterator</strong></span> concept
          if, in addition to <code class="computeroutput"><span class="identifier">X</span></code> being
          Copy Constructible, the following expressions are valid and respect the
          stated semantics.
        </p>
<div class="table">
<a name="iterator.concepts.access.swappable.swappable_iterator_requirements_"></a><p class="title"><b>Table 1.3. Swappable Iterator Requirements (in addition to Copy Constructible)</b></p>
<div class="table-contents"><table class="table" summary="Swappable Iterator Requirements (in addition to Copy Constructible)">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                  <p>
                    Expression
                  </p>
                </th>
<th>
                  <p>
                    Return Type
                  </p>
                </th>
<th>
                  <p>
                    Postcondition
                  </p>
                </th>
</tr></thead>
<tbody><tr>
<td>
                  <p>
                    <code class="computeroutput"><span class="identifier">iter_swap</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span>
                    <span class="identifier">b</span><span class="special">)</span></code>
                  </p>
                </td>
<td>
                  <p>
                    <code class="computeroutput"><span class="keyword">void</span></code>
                  </p>
                </td>
<td>
                  <p>
                    the pointed to values are exchanged
                  </p>
                </td>
</tr></tbody>
</table></div>
</div>
<br class="table-break"><div class="blurb">
<div class="titlepage"><div><div><p class="title"><b></b></p></div></div></div>
<p>
          <span class="bold"><strong>Note:</strong></span> An iterator that is a model of the
          <span class="bold"><strong>Readable</strong></span> and <span class="bold"><strong>Writable
          Iterator</strong></span> concepts is also a model of <span class="bold"><strong>Swappable
          Iterator</strong></span>. <span class="bold"><strong>--end note</strong></span>
        </p>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="iterator.concepts.access.lvalue"></a><a class="link" href="concepts.html#iterator.concepts.access.lvalue" title="Lvalue Iterator Concept">Lvalue Iterator Concept</a>
</h4></div></div></div>
<p>
          The <span class="bold"><strong>Lvalue Iterator</strong></span> concept adds the requirement
          that the return type of <code class="computeroutput"><span class="keyword">operator</span><span class="special">*</span></code> type be a reference to the value type
          of the iterator.
        </p>
<div class="table">
<a name="iterator.concepts.access.lvalue.lvalue_iterator_requirements"></a><p class="title"><b>Table 1.4. Lvalue Iterator Requirements</b></p>
<div class="table-contents"><table class="table" summary="Lvalue Iterator Requirements">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                  <p>
                    Expression
                  </p>
                </th>
<th>
                  <p>
                    Return Type
                  </p>
                </th>
<th>
                  <p>
                    Note/Assertion
                  </p>
                </th>
</tr></thead>
<tbody><tr>
<td>
                  <p>
                    <code class="computeroutput"><span class="special">*</span><span class="identifier">a</span></code>
                  </p>
                </td>
<td>
                  <p>
                    <code class="computeroutput"><span class="identifier">T</span><span class="special">&amp;</span></code>
                  </p>
                </td>
<td>
                  <p>
                    <code class="computeroutput"><span class="identifier">T</span></code> is <span class="bold"><strong>cv</strong></span> <code class="computeroutput"><span class="identifier">iterator_traits</span><span class="special">&lt;</span><span class="identifier">X</span><span class="special">&gt;::</span><span class="identifier">value_type</span></code>
                    where <span class="bold"><strong>cv</strong></span> is an optional cv-qualification.
                    pre: <code class="computeroutput"><span class="identifier">a</span></code> is dereferenceable.
                    If <code class="computeroutput"><span class="identifier">a</span> <span class="special">==</span>
                    <span class="identifier">b</span></code> then <code class="computeroutput"><span class="special">*</span><span class="identifier">a</span></code>
                    is equivalent to <code class="computeroutput"><span class="special">*</span><span class="identifier">b</span></code>.
                  </p>
                </td>
</tr></tbody>
</table></div>
</div>
<br class="table-break">
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2003, 2005 David Abrahams Jeremy Siek Thomas
      Witt<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at &lt;ulink url="http://www.boost.org/LICENSE_1_0.txt"&gt;
        http://www.boost.org/LICENSE_1_0.txt &lt;/ulink&gt;)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../index.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="concepts/traversal.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
